﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yuchen.ExtJSDTSGenerator.UI.Models
{
    public class ExtClass
    {
        public string Extend { get; set; }
        public ExtClass()
        {
            Properties = new List<ExtProperty>();
            Methods = new List<ExtMethod>();
            Configs = new List<ExtProperty>();
            Events = new List<ExtEvent>();
        }
        public string Name { get; set; }
        public string FullName
        {
            get
            {
                if (Module == null)
                {
                    return Name;
                }
                return string.Format("{0}.{1}", Module.Name, Name);
            }
        }

        public List<ExtEvent> Events { get; set; }

        public List<ExtProperty> Configs { get; set; }

        public List<ExtProperty> Properties { get; set; }
        public List<ExtMethod> Methods { get; set; }
        [JsonIgnore]
        public ExtModule Module { get; set; }
        public string ModuleName
        {
            get
            {
                if (Module == null)
                {
                    return string.Empty;
                }
                return Module.Name;
            }
        }

        public override string ToString()
        {
            return FullName;
        }
    }
}
